#!/bin/bash
while : ;
do
PID=`ps -elf | grep vortex_qos_server | grep -v supervise| grep -v grep  | awk '{print $4}'`
MEMORY=`pmap $PID | grep total | awk '{print $2}' | awk -F'K' '{print $1}'`
MAX_MEM=15000000
if [ $MEMORY -gt $MAX_MEM ]; then
 echo "MEMORY[$MEMORY]k > MAX_MEM[$MAX_MEM]k, kill pid $PID"
 kill -9 $PID
else
 echo "MEMORY[$MEMORY]k < MAX_MEM[$MAX_MEM]k normal"
fi
sleep 3600
done